<script>

	$(function() {
		$("button").button();
		$( "#radio" ).buttonset();
		$("#lcCheckboxes").buttonset();	
		$("#guidelines").hide();
	});
	
	function showExamples(){
		//window.location = "file:////D:\Cristi's Stuff\Work\Doctorat\Algoritm doctorat\Database";
		window.open("file://///D:/Cristi's Stuff/Work/Doctorat/Algoritm doctorat/Database", "Help files", "height=300, width=450");
		//window.open("http://www.google.com", "Google", "widht=300, height=300");
	}
	
	function addSH(){
		
		var aux = "";
		if ($("#option1").attr('checked')){
			aux+=$("#option1").val();
		}
		if ($("#option2").attr('checked')){
			aux+=$("#option2").val();
		}
		if ($("#option3").attr('checked')){
			aux+=$("#option3").val();
		}
		if ($("#option4").attr('checked')){
			aux+=$("#option4").val();
		}
		if ($("#option5").attr('checked')){
			aux+=$("#option5").val();
		}
		if ($("#option6").attr('checked')){
			aux+=$("#option6").val();
		}
		
		var type = $('input:radio[name=radio]:checked').val();
		var activityName = document.getElementById('activitySelect').value;
		
		var arguments = buildParameter("shName")+"&"+buildParameter("shDetails")+"&type="+type+"&lcStages="+aux+"&activityName="+activityName;
		ajaxCall("toolsManager", "4", arguments, clearSHData);
		
	}
	
	function clearSHData(data){
		var response = data;
		document.getElementById('shName').value = null;
		document.getElementById('shDetails').value = null;
		
		//trebuie schimbata clasa butoanelor....isi schimba atributul, dar nu si felul in care arata
		$('input:radio[name=radio]:checked').attr('checked', false);
		$("#option1").attr('checked', false);
		$("#option2").attr('checked', false);
		$("#option3").attr('checked', false);
		$("#option4").attr('checked', false);
		$("#option5").attr('checked', false);
		$("#option6").attr('checked', false);
		$("#radio").buttonset("refresh");
		$("#lcCheckboxes").buttonset("refresh");	
		alert(response);
	}
	
</script>

<div class="containerSmall" id="new" style="width:48%; float:left;">
	
	<div style="width:100%; margin-top:10px">
		<div style="width:35%; float:left; text-align:left">
			<b>Stakeholder's name:</b>
		</div>
		<input class="regInput" type="text" id="shName" name="shName" style="width:60%"> 
	</div>
	
	<div style="width:100%; margin-top:10px">
		<div style="width:35%; float:left; text-align:left">
			<b>Details (optional):</b>
		</div>
		<textarea class="regInput" id="shDetails" rows="2" style="width:60%"></textarea> 
	</div>
	
	<div style="width:100%; margin-top:10px">
		<div style="width:35%; float:left; text-align:left">
			<b>Type of stakeholder:</b>
		</div>
		<div id="radio" style="float:left; ">
			<input type="radio" id="radio1" name="radio" value="Internal"/><label for="radio1">Internal</label>
			<input type="radio" id="radio2" name="radio" value="External"/><label for="radio2">External</label>
		</div>
		<div style="clear:both"></div>
	</div>
	
	<div style="margin-top:15px; ">
		<b>Select the Life Cycle Stage of interest for the stakeholder</b>
	</div>
	
	<div id="lcCheckboxes" style="font-size:x-small; ;margin-top:10px; margin-bottom:10px">
		<input type="checkbox" id="option1" value="1"/><label for="option1">Concept</label>
		<input type="checkbox" id="option2" value="2"/><label for="option2">Development</label>
		<input type="checkbox" id="option3" value="3"/><label for="option3">Production</label>
		<input type="checkbox" id="option4" value="4"/><label for="option4">Use</label>
		<input type="checkbox" id="option5" value="5"/><label for="option5">Support</label>
		<input type="checkbox" id="option6" value="6"/><label for="option6">Retirement</label>
	</div>
	
	<button id="addSH" name="addSH" onclick="addSH()" style="width:40%; font-weight: bold; float:center;">Add Stakeholder</button>

</div>

<div id="guidelines" style="width:48%; float: left; margin-left:1%; ">
	<button id="shExamples" name="shExamples" onclick="showExamples()" style="width:220px; font-weight: bold; float:left; margin-left:5px;">Examples of Stakeholders</button>
	<button id="shVlcs" name="shVlcs" style="width:200px; font-weight: bold; float:right;">SH-LCS Matrix</button>
</div>

<div style="clear:both"></div>